home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / n_b_v203.zip / YESNO.DMO < prev   
Text File  |  1996-07-04  |  3KB  |  69 lines

  1. $if 0
  2.     ┌──────────────────────────╖                        PowerBASIC v3.20
  3.  ┌──┤          DASoft          ╟──────────────────────┬──────────────────╖
  4.  │  ├──────────────────────────╢    Copyright 1995    │ DATE: 1995-10-01 ╟─╖
  5.  │  │ FILE NAME   YESNO   .DMO ║          by          ╘════════════════─ ║ ║
  6.  │  │                          ║  Don Schullian, Jr.                     ║ ║
  7.  │  ╘══════════════════════════╝                                         ║ ║
  8.  │ A license is hereby granted to the holder to use this source code in  ║ ║
  9.  │ any program, commercial or otherwise,  without receiving the express  ║ ║
  10.  │ permission of the copyright holder and without paying any royalties,  ║ ║
  11.  │ as long as this code is not distributed in any compilable format.     ║ ║
  12.  │  IE: source code files, PowerBASIC Unit files, and printed listings   ║ ║
  13.  ╘═╤═════════════════════════════════════════════════════════════════════╝ ║
  14.    │                ....................................                   ║
  15.    ╘═══════════════════════════════════════════════════════════════════════╝
  16. $endif
  17.  
  18. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  19. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  20. $include "DAS-NB01.INC"
  21. $include "DAS-NB02.INC"
  22. $include "DAS-NBT1.INC"
  23. $include "DAS-NBT3.INC"
  24. COLOR 7, 0
  25. CLS
  26.  
  27.  
  28. T$ = "fYesNo?( T$, Row?, Col?, Cols?, Answer? )|"                        +_
  29.      "──────────────────────────────────────────────────────────────────"+_
  30.      "This function prints the YES and NO boxes in the dialogue box then"+_
  31.      "controls the input. You send the pertinent data in a 32byte string"+_
  32.      "using YesNoTYPE or a plane string value.  If the shadow foreground"+_
  33.      "color is > 16 then no shadow is created. If you wish to force your"+_
  34.      "users to press <ENTER> then load the keypress members with a value"+_
  35.      "of CHR$(0) or some such. If the incoming value of Answer% is above"+_
  36.      "ZERO then the function will require an answer.  If not, then <ESC>"+_
  37.      "will return a value of ZERO if pressed; else 1 will be returned if"+_
  38.      "<YES> is indicated and 2 if <NO> is indicated.||"                  +_
  39.      CHR$(9) + "DID YOU UNDERSTAND ALL THIS?"
  40.  
  41. DIM tYesNo AS YesNoTYPE
  42.   tYesNo.YesKey   = ASCII( "Y" )        ' UCASEkey is used to test this
  43.   tYesNo.YesText  = "«Y/es, I did."   ' <YES> answer (17 chars max)
  44.   tYesNo.YesAttr  =  47                 ' color attribute for <YES>
  45.   tYesNo.NoKey    = ASCII( "N" )        ' UCASEkey is used here too
  46.   tYesNo.NoText   = "╬NOo, I didn't!" ' <NO> answer (17 chars max)
  47.   tYesNo.NoAttr   =  79                 ' color attribute for <NO>
  48.   tYesNo.OffAttr  = 120                 ' "OFF" attribute
  49.   tYesNo.ShdoFore =   0                 ' shadow foreground color if < 16
  50.  
  51. TBoxDRAW   2, 6, 18, 70, 1, 25
  52. TprintTEXT 3, 8, 15, 66, T$, 1, 124, 19, 31
  53.  
  54. SELECT CASE fYesNo?( tYesNo, 17, 8, 66, 0 )
  55.   CASE 0 : A$ = "You pressed <ESC>"
  56.   CASE 1 : A$ = "You indicated <YES>"
  57.   CASE 2 : A$ = "You indicated <NO>"
  58. END SELECT
  59.  
  60. Tprint 21, 1, A$, 14
  61.  
  62. ' ───────────────────────────────────────────────────────────────────────────
  63.  
  64. FUNCTION fGetKey% () LOCAL PUBLIC
  65.   WHILE NOT INSTAT : WEND
  66.   fGetKey% = CVI( INKEY$ + CHR$(0) )
  67. END FUNCTION
  68.  
  69.